import re
dict1 = dict()


def Add():
    name = str(input('请输入姓名'))
    if name in dict1:
        print('是否修改', name, '的信息')
        n = str(input('Y.是 N.否\n请输入你的选择'))
        if n == 'Y':
            change()
        else:
            Add()
    number = int(input('请输入电话号码'))
    mail = str(input('请输入你的邮箱'))
    ex_email = re.compile(r'^[1-9][0-9]{4,10}@qq\.com')
    result = ex_email.match(mail)
    # print(result)
    if result:
        dict1[name] = {'Name': name, 'Number': number, 'Mail': mail}
    else:
        print('请输入QQ邮箱')


def search():
    name = str(input('请输入姓名'))
    if name in dict1:
        print('姓名：', dict1[name]['Name'])
        print('电话：', dict1[name]['Number'])
        print('邮箱：', dict1[name]['Mail'])
    else:
        print(name, '不存在')


def dele():
    name = str(input('请输入姓名'))
    if name in dict1:
        del dict1[name]
    else:
        print(name, '不存在')


def change():
    name = str(input('请输入姓名'))
    if name in dict1:
        print('修改n', name, '的信息')
    else:
        print(name, '不存在')
    number = int(input('请输入电话号码'))
    mail = str(input('请输入你的邮箱'))
    ex_email = re.compile(r'^[1-9][0-9]{4,10}@qq\.com')
    result = ex_email.match(mail)
    # print(result)
    if result:
        dict1[name] = {'Name': name, 'Number': number, 'Mail': mail}
    else:
        print('请输入QQ邮箱')
